feat(chat): Add fine-grained admin rights to promote#26
Merged
Conversation
`tg chat admin promote` granted a fixed broad admin set with no way to scope it. Add a --rights flag accepting admin-rights keywords (info, post, edit, delete, ban, invite, pin, add_admins, anonymous, call, topics, post/edit/delete_stories) so callers grant exactly the rights they want; omitting --rights keeps the previous broad default. promote/demote now return a RightsRow whose `granted` field surfaces the applied rights in both JSON and table output. Also scrub a stray test account name from the launchd label doc comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tg chat admin promotepreviously granted a fixed broad admin set. Add a--rightsflag taking admin-rights keywords (info, post, edit, delete, ban, invite, pin, add_admins, anonymous, call, topics, post_stories, edit_stories, delete_stories) so callers can grant exactly the rights they want.--rightskeeps the previous broad default set (backward compatible).--rightsis rejected ondemote.promote/demotenow return aRightsRow; the newgrantedfield surfaces the applied admin rights in both JSON (--json) and table output.Test plan
go build ./...,go vet ./...,golangci-lint run,go test ./...--rights+ demote rejection.promote --rights pin,delete/--rights info,invite→grantedechoes the requested set in canonical order; member role flips toadmin.infolet the target edit group info; re-promoting with onlypinthen returnedCHAT_ADMIN_REQUIREDon the same edit — confirming the mask is actually enforced, not just echoed.demote→ role returns tomember, nograntedfield.